<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

JToolBarHelper::title( JText::_( 'Comments' ), 'generic.png' );
JToolBarHelper::editList();
JToolBarHelper::deleteList('Are you sure you want to delete comments?');
?>
<form action="index.php" method="post" name="adminForm">
<table>
	<tr>
		<td align="left">
		Search: 
		<input type="text" name="search" value="<?php echo $this->search ?>" id="search" />
		<button type="submit">Go</button>
		</td>
	</tr>
</table>
<table class="adminlist">
  <thead>
    <tr>
      <th width="20">
      <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ); ?>);" />
      </th>
      <th class="title">Restaurant Name</th>
      <th width="15%">Commenter</th>
      <th width="20%">Comment Date</th>
      <th width="30%">Comment</th>
    </tr>
  </thead>
  <?php
  jimport('joomla.filter.output');
  $k = 0;
  for ($i=0, $n=count( $this->rows ); $i < $n; $i++) {
    $row = &$this->rows[$i];
    $checked = JHTML::_('grid.id', $i, $row->id );
    $link = JFilterOutput::ampReplace( 'index.php?option=' . $option . '&task=edit&controller=comments&cid[]='. $row->id );
    ?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $checked; ?></td>
      <td><a href="<?php echo $link; ?>"><?php echo $row->restaurant; ?></a></td>
      <td><?php echo $row->full_name; ?></td>
      <td><?php echo JHTML::Date($row->comment_date); ?></td>
      <td><?php echo JString::substr($row->comment_text, 0, 149); ?></td>
    </tr>
    <?php
    $k = 1 - $k;
  }
  ?>
<tfoot>
  <td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td>
</tfoot>
</table>
<?php echo JHTML::_( 'form.token' ); ?>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="controller" value="comments" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
